Conversation
## Summary - honor `--dynamic_mode=fully` when calling `cc_common.link` - add Starlark analysis tests for runtime selection and shared `link_deps` - compare Rust linkage behavior with equivalent `cc_binary` targets ## Why `cc_common.link` defaults `link_deps_statically` to true. Rust targets therefore selected the static C++ runtime even under fully dynamic linking. ## Impact Rust targets using `cc_common.link` now select the dynamic C++ runtime when built with `--dynamic_mode=fully`, matching `cc_binary` behavior. ## Validation ``` $bazel test //... ... Executed 578 out of 608 tests: 578 tests pass and 30 were skipped. ``` This is a follow-up to 226c488
krasimirgg
requested changes
Sep 29, 2026
Collaborator
There was a problem hiding this comment.
Hey, thank you, this is very nice!
I think there may be a couple of other stray places where we need to plumb these cc-std-dylibs for this setup to work. Could you add a toy example like a rust_binary that depends on a cc_library that exercises the C++ stdlib, and a test that runs the rust_binary under --dynamic_mode=fully (e.g., via a user-defined transition), ensuring that it succeeds at runtime (so the necessary cc-std-dylibs are appropriately made available to the rust binary at dynamic-link-time? -- and if that setup doesn't match your intended real use case please let me know :)
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
--dynamic_mode=fullywhen callingcc_common.linklink_depscc_binarytargetsWhy
cc_common.linkdefaultslink_deps_staticallyto true. Rust targets therefore selected the static C++ runtime even under fully dynamic linking.Impact
Rust targets using
cc_common.linknow select the dynamic C++ runtime when built with--dynamic_mode=fully, matchingcc_binarybehavior.Validation
This is a follow-up to 226c488